package com.itheima.Demo4;

import java.io.*;
import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) throws IOException {
        ArrayList<String> list = new ArrayList<>();
        list.add("Tom");
        list.add("Jerry");
        list.add("Lucy");
        list.add("Lily");
        list.add("John");
        list.add("Kevin");

        BufferedWriter br = new BufferedWriter(new FileWriter("name.txt"));
        for (String s : list) {
            br.write(s);
            br.newLine();
        }

        br.close();

    }
}
